<?php

require_once 'My/Form/Element/Uploadify.php';
require_once 'My/Form/Element/File.php';


class App_Forms_AlbumForm extends Zend_Form
{
	public function __construct()
	{
		$this->setAttribs(array(
			'name' => 'imageForm',
			'method' => 'post',
			'enctype' => 'multipart/form-data',
			'action' => 'add',
			'accept-charset' => 'UTF-8'
		));
		
		$nameField = new Zend_Form_Element_Text('name');
		$nameField->setLabel('Name');
		
		$desc = new Zend_Form_Element_Textarea('description');
		$desc->setLabel('Description');
		
		$files = new My_Form_Element_File('imageFiles');
		$files->setLabel('Image Files');
		$files->setDestination('..\user_data');
		$files->addPrefixPath('My_Form_Decorator', 'My/Form/Decorator', 'decorator');
		$files->setOptions(array(
			'multi'	=> true
		));
		
		$submit = new Zend_Form_Element_Submit('Create');
		
		$files->setDecorators(array(
			'File',
			'Description',
			'Label',
			array('Errors', array('placement' => 'prepend')),
			array('Uploadify', array('text' => 'Nahrať súbor')),
		));
		
		$files->create();
		
		$this->setDecorators(array(
			'FormElements',
			array('HtmlTag', array('tag' => 'dl')),
			'Form'
		));
		
		$this->addElements(array(
		$nameField,
		$desc,
		$submit
		));
	}
}